# rbp_group_mean.py
#用途：嵌套循环计算多组RBP实验数据均值，适配科研批量数据分析
rbp_groups = [
    [0.22,0.23,0.21,0.22,0.24],#group1
    [0.21,0.20,0.22,0.23,0.21],#group2
    [0.23,0.22,0.24,0.21,0.22] #group3
]
for group_num,group in enumerate(rbp_groups ,1):
    total = 0
    for data in group:
        total += data
    mean = total/len(group)
    print(f"第{group_num}组RBP数据均值：{mean:.2f}ug/ml")


#改代码：用sum函数
rbp_groups = [
    [0.22, 0.23, 0.21, 0.22, 0.24],  # group1
    [0.21, 0.20, 0.22, 0.23, 0.21],  # group2
    [0.23, 0.22, 0.24, 0.21, 0.22]  # group3
]
for group_num, group in enumerate(rbp_groups, 1):
    mean = sum(group)/len(group)
    print(f"第{group_num}组RBP数据均值：{mean:.2f}ug/ml")
